package com.ali.nacos.controller;

import com.ali.nacos.entity.Auth;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * create by gary 2020/3/27
 * 技术交流请加QQ:498982703
 */
@RefreshScope
@RestController
public class SampleController {

    @Value("${user.name}")
    String userName;

    @Value("${user.age}")
    int age;

    @Autowired
    private Auth auth;

    @GetMapping("/user")
    public String user() {

        return "Hello "+ userName+",your age is "+age;

    }

    @GetMapping("/auth")
    public void auth() {
        System.out.println(auth.getName());

    }
}
